let a = {};
let i = 0;
while (i < 10) {
  a[i] = i * i;
  i++;
}
a.length = i;
// 像遍历真正的数组一样遍历该对象
let total = 0;
for (let j = 0; j < a.length; ++j) {
  total += a[j];
}
console.log(total); // 285
